package com.wc.acwing.暴力.哞叫时间;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2025/2/19 14:06
 * @description
 * https://www.acwing.com/problem/content/6126/
 */
public class Main {
    /**
     * 思路：
     * https://www.acwing.com/video/5537/
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 20010, M = 128;
    // cnt[i][j] 记录 ijj 出现的次数
    static int[][] cnt = new int[M][M];
    // st[i][j] 记录 ijj 是否 >= m
    static boolean[][] st = new boolean[M][M];
    static char[] s = new char[N];
    static int n, m;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        s = (" " + sc.next()).toCharArray();
        update(1, n, 1);
        for (int i = 1; i <= n; i++) {
            char v = s[i];
            update(i - 2, i + 2, -1);
            for (char j = 'a'; j <= 'z'; j++) {
                if (v != j) {
                    s[i] = j;
                    update(i - 2, i + 2, 1);
                    update(i - 2, i + 2, -1);
                }
            }
            s[i] = v;
            update(i - 2, i + 2, 1);
        }

        int res = 0;
        for (char i = 'a'; i <= 'z' ;i++) {
            for (char j = 'a'; j <= 'z'; j++) {
                if (st[i][j]) res++;
            }
        }
        out.println(res);
        for (char i = 'a'; i <= 'z' ;i++) {
            for (char j = 'a'; j <= 'z'; j++) {
                if (st[i][j]) out.println(i + "" + j + "" + j);
            }
        }
        out.flush();
    }

    static void update(int l, int r, int v) {
        l = Math.max(1, l);
        r = Math.min(r, n);
        for (int i = l; i + 2 <= r; i++) {
            int a = s[i], b = s[i + 1], c = s[i + 2];
            if (a != b && b == c) {
                cnt[a][b] += v;
                if (cnt[a][b] >= m)
                    st[a][b] = true;
            }
        }
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

